package cn.itcast.b_etl.source;

import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

import java.util.ArrayList;

/**
 * 流处理-> source
 *
 */
public class StreamSource {

    public static void main(String[] args) throws Exception {

        /**
         * 1.socketTextStream()
         * 2.readTextFile()
         * 3.fromElements()
         * 4.fromCollection()
         * 5.addSource自定义
         */
        //1.获取流处理执行环境
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
        ArrayList<Integer> list = new ArrayList<>();
        list.add(1);
        list.add(2);
        list.add(3);
        env.fromCollection(list).print();

        env.fromSequence(0,10).print();
        env.fromElements(1,3,2).print();
//        env.readTextFile("data/order.csv").print();

        //5.触发执行
        env.execute();
    }
}
